package com.cljz.makepassenger.ui.activity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.cljz.makepassenger.R;
import com.cljz.makepassenger.base.App;
import com.cljz.makepassenger.base.BaseActivity;
import com.cljz.makepassenger.utils.ActivityManager;
import com.cljz.makepassenger.utils.date.GetSystemTimeUtil;
import com.jakewharton.rxbinding.view.RxView;

import butterknife.BindView;
import cn.droidlover.xdroidmvp.router.Router;
import rx.functions.Action1;

/**
 * Created by apple on 2017/6/6.
 */

public class WithdrawDetailsActivity extends BaseActivity {
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.fl_back)
    FrameLayout flBack;
    @BindView(R.id.tv_title_name)
    TextView tvTitleName;
    @BindView(R.id.iv_title_right)
    ImageView ivTitleRight;
    @BindView(R.id.tv_title_right)
    TextView tvTitleRight;
    @BindView(R.id.fl_title_right)
    FrameLayout flTitleRight;
    @BindView(R.id.iv_title_right1)
    ImageView ivTitleRight1;
    @BindView(R.id.fl_title_right1)
    FrameLayout flTitleRight1;
    @BindView(R.id.iv_line)
    ImageView ivLine;
    @BindView(R.id.rl_title)
    RelativeLayout rlTitle;
    @BindView(R.id.tv_estimated_arrival_time)
    TextView tvEstimatedArrivalTime;
    @BindView(R.id.tv_receiving_paypal)
    TextView tvReceivingPaypal;
    @BindView(R.id.tv_withdrawal_amount)
    TextView tvWithdrawalAmount;
    @BindView(R.id.btn_down)
    Button btnDown;

    @Override
    public void initData(Bundle savedInstanceState) {
        tvTitleName.setText("详情");
        String money = getIntent().getExtras().getString("money");
        String payId = getIntent().getExtras().getString("payId");
        tvWithdrawalAmount.setText("￥" + money);
        tvReceivingPaypal.setText(payId);
        tvEstimatedArrivalTime.setText(GetSystemTimeUtil.getNowTime());
    }

    @Override
    protected void initListener() {
        super.initListener();
        RxView.clicks(flBack)
                .compose(this.<Void>bindToLifecycle())
                .subscribe(new Action1<Void>() {
                    @Override
                    public void call(Void aVoid) {
                        Router.pop(WithdrawDetailsActivity.this);
                    }
                });
        RxView.clicks(btnDown)
                .compose(this.<Void>bindToLifecycle())
                .subscribe(new Action1<Void>() {
                    @Override
                    public void call(Void aVoid) {
                        ActivityManager.getInstance().finishAllActivity(MyWalletActivity.class);
                        Router.newIntent((Activity) App.getInstance())
                                .to(MyWalletActivity.class)
                                .launch();
                        Router.pop(WithdrawDetailsActivity.this);
                    }
                });
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_withdraw_details;
    }

    @Override
    public Object newP() {
        return null;
    }

}
